# https://leetcode.cn/problems/largest-combination-with-bitwise-and-greater-than-zero/description/


from typing import List
class Solution:
    def largestCombination(self, candidates: List[int]) -> int:
        # k位中1的数量
        def numsof1(k:int):
            ans = 0
            for num in candidates:
                if num & (1 << k):
                    ans += 1
            return ans
        
        # 整数范围在2**24之内
        ans = 0
        for i in range(24):
            ans = max(ans, numsof1(i))
        return ans